package com.ficus.road.maintain.dao.smartnew.primaryScreening;

import com.ficus.road.maintain.core.dao.BaseMongoDao;
import com.ficus.road.maintain.core.model.smartnew.PrimaryGpsRoadMapDTO;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexType;
import org.springframework.data.mongodb.core.index.GeospatialIndex;
import org.springframework.stereotype.Component;

@Component
public class PrimaryGpsRoadMapDao extends BaseMongoDao<PrimaryGpsRoadMapDTO, String> {
    @Override
    public String getCollectionName() {
        return "primary_gps_road_map";
    }

    @Override
    public void indexOperation() {
        GeospatialIndex geoIndex = new GeospatialIndex("location").typed(GeoSpatialIndexType.GEO_2DSPHERE);
        super.getMongoTemplate().indexOps(getCollectionName()).ensureIndex(geoIndex);
    }
}
